package messages;

import game.PlayerMove;


/**
 * PlayerMoveMessage
 * 
 * Message sent by the player to the server when he makes a move.
 * The server fills the "nextPlayer" field with the Player that should
 * make the next move.
 */
public class PlayerMoveMessage extends Message {

	public PlayerMoveMessage(int matchId, PlayerMove move) {
		super();
		
		this.matchId = matchId;
		this.move = move;		
	}

	public int getMatchId() {
		return this.matchId;
	}
	
	
	public PlayerMove getMove() {
		return this.move;
	}
	
	
	public String getPlayerLogin() {
		return this.playerLogin;
	}


	public void setPlayerLogin(String playerLogin) {
		this.playerLogin = playerLogin;
	}
	

	public String getNextPlayerLogin() {
		return this.nextPlayerLogin;
	}
	
	
	public void setNextPlayerLogin(String nextPlayerLogin) {
		this.nextPlayerLogin = nextPlayerLogin;
	}
	
	
	@Override
	public String toString() {
		return super.toString() + " PlayerMove (login = " + this.playerLogin + ", matchId = " + this.matchId + ", nextPlayer = " + nextPlayerLogin + ") " + this.move;
	}
	
	
	private int matchId;			// Match identifier. Used to identify the match this move refers to.
	private PlayerMove move;		// Contains move information
	private String playerLogin;		// The player who made this move (filled by the server for security reasons)
	private String nextPlayerLogin;	// The next player to play (filled by the server).
	private static final long serialVersionUID = 1L;

}
